﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Buddy.Samples
{
    static partial class Program
    {
        static void Samples_Args()
        {
            var args = new Args();

            // check if h, /h, -h, --h, help, /help, -help or --help is supplied
            var showHelp = args["help"].IsSupplied() || args["h"].IsSupplied();

            if (showHelp)
            {
                var text = new StringBuilder();
                text.AppendLine("1) if you provid a command line argument like show or /show or -show or --show then you will get 'show' (the switch, itself)");
                text.AppendLine("2) if you provid a command line argument like /show:val or -show:val or --show:val or /show=val or -show=val or --show=val you will get 'val' (the value of the switch)");
                text.AppendLine("3) if you provid a command line argument like (/|-|--)show(:|=)\"val with space\" you will get 'val with space'");
                text.AppendLine("4) if you provid a command line argument like (/|-|--)put val1 val2 then you will get two values: 'val1' 'val2'");

                Console.WriteLine(text);
            }

            // check if '(/|-|--)put val1 val2' or '(/|-|--)put val1' or '(/|-|--)put' is supplied
            var switchWithArgs = args["put", 2];
            if (switchWithArgs.IsSupplied())
            {
                Console.WriteLine("'put' is supplied");
                foreach (var val in switchWithArgs) Console.WriteLine(val);
            }

            // check if (/|-|--)show or (/|-|--)show(:|=)val is supplied
            var show = args["show"];
            if (show.IsSupplied()) Console.WriteLine(show);
        }
    }
}
